/**
 * Copyright (C) 2019 Bonitasoft S.A.
 * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation
 * version 2.1 of the License.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along with this
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA.
 **/
package org.bonitasoft.engine.api.impl.converter;

import static java.lang.String.format;

import org.assertj.core.api.AbstractAssert;
import org.bonitasoft.engine.page.SPage;

/**
 * {@link SPage} specific assertions - Generated by CustomAssertionGenerator.
 */
public class SPageAssert extends AbstractAssert<SPageAssert, SPage> {

    /**
     * Creates a new </code>{@link SPageAssert}</code> to make assertions on actual SPage.
     *
     * @param actual the SPage we want to make assertions on.
     */
    public SPageAssert(SPage actual) {
        super(actual, SPageAssert.class);
    }

    /**
     * An entry point for SPageAssert to follow AssertJ standard <code>assertThat()</code> statements.<br>
     * With a static import, one's can write directly : <code>assertThat(mySPage)</code> and get specific assertion with
     * code completion.
     *
     * @param actual the SPage we want to make assertions on.
     * @return a new </code>{@link SPageAssert}</code>
     */
    public static SPageAssert assertThat(SPage actual) {
        return new SPageAssert(actual);
    }

    /**
     * Verifies that the actual SPage's contentName is equal to the given one.
     *
     * @param contentName the given contentName to compare the actual SPage's contentName to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's contentName is not equal to the given one.
     */
    public SPageAssert hasContentName(String contentName) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> contentName to be:\n  <%s>\n but was:\n  <%s>", actual,
                contentName, actual.getContentName());

        // check
        if (!actual.getContentName().equals(contentName)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's contentType is equal to the given one.
     *
     * @param contentType the given contentType to compare the actual SPage's contentType to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's contentType is not equal to the given one.
     */
    public SPageAssert hasContentType(String contentType) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> contentType to be:\n  <%s>\n but was:\n  <%s>", actual,
                contentType, actual.getContentType());

        // check
        if (!actual.getContentType().equals(contentType)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's description is equal to the given one.
     *
     * @param description the given description to compare the actual SPage's description to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's description is not equal to the given one.
     */
    public SPageAssert hasDescription(String description) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> description to be:\n  <%s>\n but was:\n  <%s>", actual,
                description, actual.getDescription());

        // check
        if (!actual.getDescription().equals(description)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's displayName is equal to the given one.
     *
     * @param displayName the given displayName to compare the actual SPage's displayName to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's displayName is not equal to the given one.
     */
    public SPageAssert hasDisplayName(String displayName) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> displayName to be:\n  <%s>\n but was:\n  <%s>", actual,
                displayName, actual.getDisplayName());

        // check
        if (!actual.getDisplayName().equals(displayName)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's installationDate is equal to the given one.
     *
     * @param installationDate the given installationDate to compare the actual SPage's installationDate to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's installationDate is not equal to the given one.
     */
    public SPageAssert hasInstallationDate(long installationDate) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> installationDate to be:\n  <%s>\n but was:\n  <%s>", actual,
                installationDate, actual.getInstallationDate());

        // check
        if (actual.getInstallationDate() != installationDate) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's installedBy is equal to the given one.
     *
     * @param installedBy the given installedBy to compare the actual SPage's installedBy to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's installedBy is not equal to the given one.
     */
    public SPageAssert hasInstalledBy(long installedBy) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> installedBy to be:\n  <%s>\n but was:\n  <%s>", actual,
                installedBy, actual.getInstalledBy());

        // check
        if (actual.getInstalledBy() != installedBy) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's lastModificationDate is equal to the given one.
     *
     * @param lastModificationDate the given lastModificationDate to compare the actual SPage's lastModificationDate to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's lastModificationDate is not equal to the given one.
     */
    public SPageAssert hasLastModificationDate(long lastModificationDate) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> lastModificationDate to be:\n  <%s>\n but was:\n  <%s>", actual,
                lastModificationDate, actual.getLastModificationDate());

        // check
        if (actual.getLastModificationDate() != lastModificationDate) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's lastUpdatedBy is equal to the given one.
     *
     * @param lastUpdatedBy the given lastUpdatedBy to compare the actual SPage's lastUpdatedBy to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's lastUpdatedBy is not equal to the given one.
     */
    public SPageAssert hasLastUpdatedBy(long lastUpdatedBy) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> lastUpdatedBy to be:\n  <%s>\n but was:\n  <%s>", actual,
                lastUpdatedBy, actual.getLastUpdatedBy());

        // check
        if (actual.getLastUpdatedBy() != lastUpdatedBy) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's name is equal to the given one.
     *
     * @param name the given name to compare the actual SPage's name to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's name is not equal to the given one.
     */
    public SPageAssert hasName(String name) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> name to be:\n  <%s>\n but was:\n  <%s>", actual, name,
                actual.getName());

        // check
        if (!actual.getName().equals(name)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage's processDefinitionId is equal to the given one.
     *
     * @param processDefinitionId the given processDefinitionId to compare the actual SPage's processDefinitionId to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage's processDefinitionId is not equal to the given one.
     */
    public SPageAssert hasProcessDefinitionId(long processDefinitionId) {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> processDefinitionId to be:\n  <%s>\n but was:\n  <%s>", actual,
                processDefinitionId, actual.getProcessDefinitionId());

        // check
        if (actual.getProcessDefinitionId() != processDefinitionId) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage is provided.
     *
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage is not provided.
     */
    public SPageAssert isProvided() {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("Expected actual SPage to be provided but was not.", actual);

        // check
        if (!actual.isProvided())
            throw new AssertionError(errorMessage);

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SPage is not provided.
     *
     * @return this assertion object.
     * @throws AssertionError - if the actual SPage is provided.
     */
    public SPageAssert isNotProvided() {
        // check that actual SPage we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("Expected actual SPage not to be provided but was.", actual);

        // check
        if (actual.isProvided())
            throw new AssertionError(errorMessage);

        // return the current assertion for method chaining
        return this;
    }

}
